<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use \Illuminate\Routing\Router;

use App\Http\Controllers\Api\Web\IndexController;
use App\Http\Controllers\Api\Web\LoginController;
use App\Http\Controllers\Api\Web\UserController;
use App\Http\Controllers\Api\Wap\WxController;
use App\Http\Controllers\Api\Wap\LoginController as WapLoginController;
use App\Http\Controllers\Api\Wap\IndexController as WapIndexController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['prefix'=>'api'],function (Router $router){

    $router->get('/email',[LoginController::class,'email']);
    $router->get('/suggest',[LoginController::class,'suggest']);
    $router->post('/phoneLogin',[LoginController::class,'phoneLogin']);
    $router->post('/setPhone',[UserController::class,'setPhone']);
    $router->post('/modifyPhone',[UserController::class,'modifyPhone']);
    $router->get('/exchangeCode',[UserController::class,'exchangeCode']);

    $router->get('/',[IndexController::class,'index']);
    $router->get('/lst',[IndexController::class,'lst']);
    $router->get('/detail',[IndexController::class,'detail']);
    $router->get('/showMemberType',[IndexController::class,'showMemberType']);
    $router->get('/exShowMemberType',[IndexController::class,'exShowMemberType']);
    $router->post('/buyMember',[IndexController::class,'buyMember']);
    $router->post('/exBuyMember',[IndexController::class,'exBuyMember']);
    $router->post('/buyArticle',[IndexController::class,'buyArticle']);
    $router->get('/favorite',[IndexController::class,'favorite']);
    $router->get('/favoriteLst',[IndexController::class,'favoriteLst']);
    $router->get('/login',[LoginController::class,'login']);

    $router->get('/wxOpenLogin',[LoginController::class,'wxOpenLogin']);
    $router->get('/isLogin',[LoginController::class,'isLogin']);
    $router->get('/userInfo',[LoginController::class,'userInfo']);
    $router->get('/exuserInfo',[LoginController::class,'exuserInfo']);
    $router->get('/exportFile',[IndexController::class,'exportFile']);
    $router->get('/exportZip',[IndexController::class,'exportZip']);
    $router->get('/queryOrder',[IndexController::class,'queryOrder']);



    $router->any('/wap/wxLogin',[WapLoginController::class,'wxLogin']);
    $router->any('/wap/wxConfig',[WapLoginController::class,'wxConfig']);
    $router->post('/wap/buyMember',[WapIndexController::class,'buyMember']);
    $router->post('/wap/buyArticle',[WapIndexController::class,'buyArticle']);
    $router->post('/wap/getUsers',[WapIndexController::class,'getUsers']);

});


Route::group(['prefix'=>'wx'],function (Router $router){
    $router->any('server',[WxController::class,'server']);
    $router->any('payCallback',[WxController::class,'payCallback']);
    $router->any('payCallbackForArticle',[WxController::class,'payCallbackForArticle']);
    $router->get('setMenu',[WxController::class,'setMenu']);
});
